<?php
	if(isset($_POST['value']))
	{
		include "../../app/connection.php";
		$value = $_POST['value'];
		$id = explode(",",$value);
		$_count = count($id);
		$t="";
		for($i = 0; $i < $_count; $i++)
		{
			$t .= $id[$i].";";
			$str = "SELECT * FROM tintuc WHERE ID='$id[$i]'";
			$r = mysql_query($str);
			$rw = mysql_fetch_array($r);
			if($rw['F_URL'] == "")
			{
				$sql = "DELETE FROM tintuc WHERE ID='$rw[0]'"; // delete dua vao id
				$rs = mysql_query($sql) or die(mysql_error($connect));
			}
			else
			{
				$path = $rw['F_URL'];
				if(strpos($path,";") !== false) //cat chuoi neu co nhiu file thuoc 1 thong bao
				{
					$path = explode(";",$path);
					$count_path = count($path);
					for($j = 0; $j < $count_path; $j++)
					{
						unlink($path[$i]);
					}
				}
				else
				{
					unlink($path);
				}
				$sql = "DELETE FROM tintuc WHERE ID='$rw[0]'"; // delete dua vao id
				$rs = mysql_query($sql) or die(mysql_error($connect));
			}
		}
		echo $t;
	}
?>